/* Hex character manipulation support.
   Copyright (C) 1995-2020 Free Software Foundation, Inc.

This file is part of the libiberty library.
Libiberty is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.

Libiberty is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Library General Public License for more details.

You should have received a copy of the GNU Library General Public
License along with libiberty; see the file COPYING.LIB.  If
not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
Boston, MA 02110-1301, USA.  */

#include <stdio.h>  /* for EOF */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "libiberty.h"
#include "safe-ctype.h" /* for HOST_CHARSET_ASCII */

#if EOF != -1
 #error "hex.c requires EOF == -1"
#endif

/*

@deftypefn Extension void hex_init (void)

Initializes the array mapping the current character set to
corresponding hex values.  This function must be called before any
call to @code{hex_p} or @code{hex_value}.  If you fail to call it, a
default ASCII-based table will normally be used on ASCII systems.

@end deftypefn

@deftypefn Extension int hex_p (int @var{c})

Evaluates to non-zero if the given character is a valid hex character,
or zero if it is not.  Note that the value you pass will be cast to
@code{unsigned char} within the macro.

@end deftypefn

@deftypefn Extension {unsigned int} hex_value (int @var{c})

Returns the numeric equivalent of the given character when interpreted
as a hexadecimal digit.  The result is undefined if you pass an
invalid hex digit.  Note that the value you pass will be cast to
@code{unsigned char} within the macro.

The @code{hex_value} macro returns @code{unsigned int}, rather than
signed @code{int}, to make it easier to use in parsing addresses from
hex dump files: a signed @code{int} would be sign-extended when
converted to a wider unsigned type --- like @code{bfd_vma}, on some
systems.

@end deftypefn

@undocumented _hex_array_size
@undocumented _hex_bad
@undocumented _hex_value

*/
